import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

export const num = 16
function generateRoutes () {
  const routes = [{
    path: 'home',
    component: () => import('@/views/Home.vue')
  }]
  for (let index = 1; index <= num; index++) {
    routes.push({
      path: `/test${index}`,
      component: () => import(`@/views/Test${index}.vue`)
    })
  }
  return routes
}

const router = new VueRouter({
  routes: [
    {
      path: '/',
      component: () => import('@/views/Layout.vue'),
      redirect: '/home',
      children: generateRoutes()
    },
    {
      path: '/rabbit',
      component: () => import('@/views/Rabbit.vue')
    }
  ]
})

export default router